<template>
  <wrap title="芝麻信用授权">
    <div slot="page">
      <div class="fill-box light-bg">
          <div class="fill-item border-bottom flex flex-justify-between flex-align-center">
            <span class="font-15 label">姓名</span>
            <span class="font-15 fill-data content">{{auth.name}}</span> 
          </div>
          <div class="fill-item border-bottom flex flex-justify-between flex-align-center">
            <span class="font-15 label">身份证号</span>
            <span class="font-15 fill-data content">{{auth.idCard}}</span> 
          </div>
      </div>
      <div class="tip-wrap">
        <p class="tip">{{auth.desc}}</p>
      </div> 
      <a href="javascript:;" class="next-btn red-bg font-16" @click="next(true)">下一步</a>
      <a href="javascript:;" class="next-btn blue" @click="next(false)">跳过该步骤</a> 
    </div>
  </wrap>
</template>
<script>
  import wrap from '../../components/wrap.vue'
  export default {
    components: {wrap},
    data () {
      return {
        auth: {
          idCard: '',
          name: '',
          desc: ''
        }
      }
    },
    created () {
      this.getUserInfo()
    },
    methods: {
      getUserInfo () {
        let self = this
        self.$api.fill.getZmxyAuthInfo().then(res => {
          if (res.code === 0) {
            let data = res.data
            self.auth = data
          } else {
            self.$MessageBox.alert(res.userMsg)
          }
        })
      },
      next (authFlag) {
        let self = this
        self.$api.fill.getUrlOrSkip(authFlag).then(res => {
          if (res.code === 0) {
            let url = res.data
            if (url !== '1') {
              window.location.href = url
            } else {
              self.$router.push('/fill/verify/')
            }
          } else {
            self.$MessageBox.alert(res.userMsg)
          }
        })
      }
    }
  }
</script>
<style scoped>
  .tip-wrap{padding: 20px 10px 0 10px;}
  .tip{line-height: 20px;text-align: left;color:rgb(238, 18, 18);font-size: 12px;}
</style>